package thread.synchronization;
//example of java synchronized method  
public class SnychroniszationedTheads {
synchronized void printTable(int n ){//synchronized table
	for(int j=1;j<=5;j++){
		System.out.println(j*n);
	try{
		Thread.sleep(500);
	}catch(Exception e){
		System.out.println(e);
	}
}
}
	class MyThread1 extends Thread{                              //????????  +++ ysa kyo krte hai 
		SnychroniszationedTheads t;
		MyThread1(SnychroniszationedTheads t){
		this.t=t;	
		}
		public void run(){
			System.out.println("First Thread Snychronized...");
			t.printTable(5);
		}
		
	}
	class MyThread2 extends Thread{
		SnychroniszationedTheads t;
	 MyThread2(SnychroniszationedTheads t){
		this.t=t;
	}
	public void run(){
		 System.out.println("Second Thread Snychonized...");
		t.printTable(100);
	}
	}

}
